package adv7.bank2;

import java.util.Random;

public class Taker extends Thread {
	private Account ac;

	public Taker(Account ac, String name) {
		super(name);
		this.ac = ac;
	}

	public void takeMoney(int m) {
		ac.takeMoney(m);
	}

	@Override
	public void run() {
		Random r = new Random();
		while (true) {
			int m = r.nextInt(400);
			takeMoney(m);
			try {
				super.sleep(100);
			} catch (InterruptedException e) {
				// TODO 自动生成的 catch 块
				e.printStackTrace();
			}
		}
	}
}
